import React from 'react';
import {BrowserRouter, Navigate, Route, Routes} from 'react-router-dom'
import NewsSandBox from "../view/sandbox/NewsSandBox";
import Login from "../view/login/Login";
// import Home from "../view/sandbox/home/Home";
// import UserList from "../view/sandbox/user-manage/UserList";
// import RoleList from "../view/sandbox/right-manage/RoleList";
// import RightList from "../view/sandbox/right-manage/RightList";
import NewsRouter from "../components/sandbox/NewsRouter";

const IndexRouter = () => {
    return (
        <BrowserRouter>
            <Routes>
                <Route path='/login' element={<Login/>}/>
                <Route path='/' element={localStorage.getItem('token')? <NewsSandBox/> : <Navigate to="/login"/>}>
                    <Route path='*' element={<NewsRouter/>}/>
                    <Route path='/' element={<Navigate to="/home"/>}/>
                </Route>
            </Routes>
        </BrowserRouter>
    );
};

export default IndexRouter;